package com.qnw.CardGroupManagement.adapter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.ygo.feihua.R;
import java.util.List;
import java.util.Map;
import com.qnw.CardGroupManagement.bean.*;

public class AdapterKzlist extends BaseAdapter
{
	List<Deck> data;
	Context context;
	Zujian zujian;
	public  AdapterKzlist(Context context,List<Deck> data){	
		this.context=context;
		this.data=data;
	}
	class Zujian{
		TextView kz_name,kz_fl;
	}
	public void sx(){
	
		notifyDataSetInvalidated();

		//notifyDataSetChanged();
	}

	@Override
	public int getCount()
	{
		// TODO: Implement this method
		return data.size();
	}

	@Override
	public Object getItem(int p1)
	{
		// TODO: Implement this method
		return data.get(p1);
	}

	@Override
	public long getItemId(int p1)
	{
		// TODO: Implement this method
		return p1;
	}

	@Override
	public View getView(int position, View p2, ViewGroup p3)
	{
		if(p2==null){
			zujian=new Zujian();
			p2=LayoutInflater.from(context).inflate(R.layout.item_kzlist,null);
			
			zujian.kz_name=(TextView) p2.findViewById(R.id.kz_name);
			zujian.kz_fl=(TextView) p2.findViewById(R.id.kz_fl);
			
			
			p2.setTag(zujian);
		}else{
			zujian=(Zujian)p2.getTag();
		}
		zujian.kz_name.setText(data.get(position).getName());
		zujian.kz_fl.setText(data.get(position).getType().getName());
		
		
		
		
		
		// TODO: Implement this method
		return p2;
	}
	
	
	
}
